/*
 * AboutPerson.h
 *
 *  Created on: 15.04.2010
 *      Author: king
 */

#ifndef ABOUTPERSON_H_
#define ABOUTPERSON_H_

#include "ui_AboutPerson.h"
#include "Person.h"
#include <QGraphicsPixmapItem>
#include <QGraphicsScene>
#include "db/DataSourceManager.h"

namespace etu {
namespace ui {

using etu::db::DataSourceManager;
using etu::db::DataSource;
using etu::genealogy_tree::Person;

class CAboutPerson: public QWidget, public Ui::AboutPerson
{
   Q_OBJECT

   DataSource* m_dataSource;
   std::string m_photoId;
   bool m_isPhotoChanged;
   QGraphicsScene* m_photoScene;
   QGraphicsPixmapItem* m_pixmap;;
   Person* m_person;
   void showPhoto(QPixmap* pixmap);
   void updatePhoto();

signals:
   void aboutPersonChange();
   void updatePhoto(QPixmap*);

private slots:
   void loadPhoto();
   void showPersonData();
   void setPerson(Person* person, QPixmap* pixmap);
   void apply();

public:
   CAboutPerson(QWidget *parent =0);

   void init(DataSource* dataSource);

};

}
}
#endif /* ABOUTPERSON_H_ */
